﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Configuration;
using JumJob.Models;
using System.Data.Objects;

namespace JumJob.Controllers
{
    public class CategoryController : Controller
    {
     
        //
        // GET: /Category/

     

        public ActionResult Index()
        {
            int jobsPerCategory = int.Parse(WebConfigurationManager.AppSettings["jobs_per_category"]);
            ViewData["jobs_per_category"] = jobsPerCategory;
            return View(Category.getCategoryList());
        }

        [ChildActionOnly]
        public ActionResult CategoryMenu() 
        {
            return View(Category.getCategoryList());
        }

        public ActionResult ListJobs(int id) 
        {
            jum_jobEntities jjDB = new jum_jobEntities();
            Category res=(from categoria in jjDB.jum_category
                         where categoria.id==id
                          select categoria).FirstOrDefault();
            return View(res);
                     
        }

    }
}
